package com.example.sys.controller;


import com.example.config.ResponseBean;
import com.example.config.UnicomResponseEnums;
import com.example.sys.entity.AsyncRoutes;
import com.example.sys.service.AsyncRoutesService;
import com.example.sys.vo.AsyncRoutesVo;
import com.example.util.BaseUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author anan
 * @since 2019-09-10
 */
@RestController
@RequestMapping("/sys/async-routes")
public class AsyncRoutesController {

    @Autowired
    private AsyncRoutesService asyncRoutesService;

    @GetMapping("/getAsyncRoutes")
//    @RequiresPermissions({"sys:asyncRoutes:list"})
    public ResponseBean<UnicomResponseEnums> getAsyncRoutes() {
        BaseUtils baseUtils = new BaseUtils();
        List<AsyncRoutes> list = asyncRoutesService.list();
        List<AsyncRoutesVo> lists = baseUtils.ArrangementAsyncRoutesTree(list, 0L);
        System.out.println(lists);
        return new ResponseBean(true, lists,UnicomResponseEnums.SUCCESS_OPTION);
    }
}
